Skip to content

perf(b12x/comm/roce): raise ring mailbox window to 16 and drain relays eagerly - #157

Open
fordbmorris wants to merge 1 commit into
local-inference-lab:mainfrom
fordbmorris:pr/roce-proxy-window16-eager-drain
Open

fordbmorris wants to merge 1 commit into
local-inference-lab:mainfrom
fordbmorris:pr/roce-proxy-window16-eager-drain

Conversation

@fordbmorris

@fordbmorris fordbmorris commented Nov 28, 2026 •

Copy link
Copy Markdown

Why

On a four-node 200 Gb/s --roce-ring, RING_WINDOW = 8 (512 KiB/rail) sat below the two-hop relay BDP knee and run_pipe_op deferred drain_all(c) while actively posting chunks, slowing large prefill collectives. Raising RING_WINDOW also requires validating ring window/region sizing in the connect handshake (without bumping ROCE_ABI_VERSION = 14, so existing exported cores stay compatible) and tightening the QP send-queue reservation threshold so world = 16 still has headroom for up to 256 unreserved per-origin ACKs.

This is the upstream counterpart to NVIDIA/hyperflare-inference#577 (merge this PR first so helios/native/roce_proxy.c stays in lockstep).

What Changed

  • flashinfer/experimental/b12x/comm/roce/_roce_proxy.c:
    • Raise RING_WINDOW from 8 to 16 (1 MiB/rail; 2.008 MiB/rank in the group, 8.03 MiB/rank at world = 4).
    • Append uint32_t ring_window and uint64_t ring_bytes to roce_blob_t (sizeof(roce_blob_t) 1168 -> 1176 bytes, keeping ROCE_ABI_VERSION = 14 unchanged), populate them in roce_local_blob (0 in mesh mode), and reject mismatches in roce_connect.
    • Tighten reserve() and ring_service_slot() to ROCE_SEND_DEPTH / 8 (64 signaled ops, at most 192 chained WRs, leaving 256 WRs for unreserved per-origin ACKs at world = 16 plus 64 WRs of provider SQE overhead), enforced via _Static_assert.
    • Call drain_all(c) inside run_pipe_op when posted != 0 && c->ring != NULL. Non-ring topologies (c->ring == NULL) are unaffected.
  • tests/experimental/b12x/comm/test_roce_proxy.py: add test_ring_blob_handshake_rejects_window_and_size_mismatch verifying ABI_VERSION == 14, 1176-byte blob sizing, legacy 1168-byte blob rejection, and live-HCA roce_connect rejection of mismatched ring_window and ring_bytes.

Benefit & Tests

  • 4× GB10 --roce-ring (H = 4608 BF16): ReduceScatter -9.7% (M = 2048), -7.4% (M = 4096), -7.1% (M = 8192, 3.487 -> 3.239 ms, 17.48 GB/s bus BW); GatherShards M = 8192 -6.2%; Twoshot M = 8192 -6.6% (98.6% of 200 Gb/s line rate); Oneshot decode M = 1..24 unchanged (19.7–66.8 us).
  • pytest -v tests/experimental/b12x/comm/test_roce_proxy.py: 21/21 passed on ARM64 GB10 (dgx2) with live ConnectX-7 HCA verification of handshake rejection.
  • validate_roce_ring_native.py across 4× GB10: passed --world-size 4 --iterations 120 --skew-rank 2 --scatter-gather (ring) and --iterations 60 --ring-open --scatter-gather (chain) with 0/16 RDMA port errors.

Caveats: Benchmarked on a four-node GB10 switchless ring and chain only; rings larger than four nodes were not tested on hardware (world = 16 send-queue headroom is enforced statically), and non-ring setups (c->ring == NULL) are unaffected.

tests/experimental/b12x/comm/test_roce_proxy.py

Discord: woooflet

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 41 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8ed2133b-2160-40fa-bd61-843220233508
Commits

Reviewing files that changed from the base of the PR and between 0ddf1a4 and 5237366.

Files selected for processing: 1

  • flashinfer/experimental/b12x/comm/roce/_roce_proxy.c
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…ndshake, and drain eagerly

On a four-node switchless 200 Gb/s ConnectX-7 RoCE ring, RING_WINDOW=8
(512 KiB in flight per origin and rail) saturates below the two-hop relay
bandwidth-delay product during large prefill collectives, and run_pipe_op
deferred drain_all(c) while actively posting chunks, delaying relay
forwarding on intermediate ranks. Raising RING_WINDOW without a connect-time
check would let mixed-build ranks compute mismatched remote mailbox and ACK
offsets, while retaining the previous send-queue cap (ROCE_SEND_DEPTH / 4)
would leave insufficient headroom for up to 256 unreserved per-origin ACKs
at world=16.

Changes in flashinfer/experimental/b12x/comm/roce/_roce_proxy.c:
- Raise RING_WINDOW from 8 to 16 (1 MiB in flight per origin and rail;
  2.008 MiB per rank in the group, 8.03 MiB/rank at world=4).
- Append uint32_t ring_window and uint64_t ring_bytes to roce_blob_t
  (growing sizeof(roce_blob_t) from 1168 to 1176 bytes while keeping
  ROCE_ABI_VERSION=14 unchanged so previously exported cores stay
  compatible). Populate both fields in roce_local_blob (0 in mesh mode)
  and reject any mismatch in roce_connect.
- Tighten the send-queue reservation threshold in reserve() and
  ring_service_slot() to ROCE_SEND_DEPTH / 8 (64 signaled ops, at most
  192 chained WRs, leaving 256 WRs for unreserved per-origin ACKs at
  world=16 plus 64 WRs of provider SQE overhead) and enforce this bound
  with a compile-time _Static_assert.
- Call drain_all(c) inside run_pipe_op when posted is nonzero and c->ring
  is active; non-ring transports (c->ring == NULL) are unchanged.
- Add test_ring_blob_handshake_rejects_window_and_size_mismatch in
  tests/experimental/b12x/comm/test_roce_proxy.py covering ABI 14
  retention, 1176-byte blob sizing, legacy 1168-byte blob rejection, and
  live-HCA roce_connect rejection of mismatched ring_window and ring_bytes.

Measured effect on four DGX Spark GB10 nodes over 200 Gb/s ConnectX-7
(--roce-ring, H=4608 BF16): ReduceScatter drops 7.1% at M=8192 (3.487 to
3.239 ms, 17.48 GB/s bus BW) and 7.4%-9.7% at M=2048..4096; GatherShards
at M=8192 drops 6.2% (3.491 to 3.275 ms); Twoshot at M=8192 drops 6.6%
(6.889 to 6.435 ms). One-shot decode latency (M=1..24) is unchanged
(19.7-66.8 us).

Validation on four NVIDIA GB10 (ARM64) nodes:
- pytest -v tests/experimental/b12x/comm/test_roce_proxy.py: 21/21 passed
  on dgx2 with live ConnectX-7 HCA verification of window/size mismatch
  rejection.
- validate_roce_ring_native.py --world-size 4 --iterations 120
  --skew-rank 2 --scatter-gather (ring) and --iterations 60 --ring-open
  (chain): all four ranks passed with 0/16 ConnectX-7 RDMA port errors.
- Rings larger than four nodes were not benchmarked on hardware; world=16
  send-queue headroom is enforced statically.

Signed-off-by: woooflet <ford@fordmorris.com>
@fordbmorris
fordbmorris force-pushed the pr/roce-proxy-window16-eager-drain branch from 5237366 to b46125c Compare November 30, 2026 00:38
@fordbmorris

Copy link
Copy Markdown
Author

Updated and rebased onto current main (9b69d3cb, commit b46125c8) in lockstep with NVIDIA/hyperflare-inference#577 review feedback from @original-el8:

  • Added connect-time validation of ring_window and ring_bytes in roce_blob_t / roce_local_blob / roce_connect (sizeof(roce_blob_t) 1168 -> 1176 bytes) while keeping ROCE_ABI_VERSION = 14 unchanged so existing exported cores remain compatible.
  • Tightened reserve() and ring_service_slot() to ROCE_SEND_DEPTH / 8 (64 * 3 + 16 * 16 = 448 <= 512) with a compile-time _Static_assert so world = 16 retains full headroom for unreserved per-origin ACKs.
  • Added test_ring_blob_handshake_rejects_window_and_size_mismatch in tests/experimental/b12x/comm/test_roce_proxy.py.
  • Re-verified on 4× NVIDIA GB10 (--roce-ring & --ring-open): pytest tests/experimental/b12x/comm/test_roce_proxy.py (21/21 passed with live ConnectX-7 HCA mismatch rejection) and validate_roce_ring_native.py (120 ring iters + 60 chain iters, --skew-rank 2 --scatter-gather, 0/16 RDMA port errors).

fordbmorris pushed a commit to fordbmorris/hyperflare-inference that referenced this pull request Nov 30, 2026
…nd drain relays eagerly

On a four-node switchless 200 Gb/s ConnectX-7 --roce-ring, RING_WINDOW=8
(512 KiB in flight per origin and rail) sat below the two-hop relay
bandwidth-delay product during large prefill collectives, and run_pipe_op
deferred drain_all(c) while actively posting chunks, delaying relay
forwarding on intermediate ranks. Because RING_WINDOW determines remote
mailbox and ACK offsets (ring_slot and ring_ack_offset), mixed-build
ranks with different window sizes would otherwise connect and write to
mismatched remote RDMA addresses, and keeping ROCE_SEND_DEPTH / 6 (or
/ 4 in ring_service_slot) would not leave enough QP send-queue headroom
for 256 unreserved per-origin ACKs at world=16 with RING_WINDOW=16.

Exact changes (in lockstep with local-inference-lab/flashinfer#157, which
must merge before this vendored update):
- helios/native/roce_proxy.c:
  - Raise RING_WINDOW from 8 to 16 (1 MiB in flight per origin and rail;
    2.008 MiB per rank in the group, 8.03 MiB/rank at world=4, 32.13 MiB
    at world=16).
  - Append uint32_t ring_window and uint64_t ring_bytes to roce_blob_t
    (growing sizeof(roce_blob_t) from 1168 to 1176 bytes) while keeping
    ROCE_ABI_VERSION=14 unchanged so previously exported model cores load
    and serve without re-export. Populate both fields in roce_local_blob
    (0 in mesh mode) and validate exact agreement in roce_connect.
  - Tighten reserve() and ring_service_slot() to ROCE_SEND_DEPTH / 8 (64
    signaled ops, at most 192 chained WRs, leaving room for up to 256
    unreserved per-origin ACKs at world=16 plus 64 WRs of provider SQE
    overhead), guarded by a compile-time _Static_assert.
  - Call drain_all(c) inside run_pipe_op when posted is nonzero and
    c->ring is active. Non-ring transports (c->ring == NULL) are
    unaffected.
- helios/src/execution/roce.rs: assert roce_blob_bytes() == 1176 and
  verify peer_blobs rejects legacy 1168-byte peer records alongside
  foreign ABI and truncated records.
- docs/roce-ring.md: update documented ring host-memory sizing (2.008 MiB
  per rank, 8.03 MiB at 4 ranks, 32.13 MiB at 16 ranks) and 16-packet
  in-flight window.

Measured benefit on four DGX Spark GB10 nodes over 200 Gb/s ConnectX-7
(--roce-ring, H=4608 BF16): ReduceScatter drops 7.1% at M=8192 (3.487 to
3.239 ms, 17.48 GB/s bus BW) and 7.4%-9.7% at M=2048..4096; GatherShards
at M=8192 drops 6.2% (3.491 to 3.275 ms); Twoshot at M=8192 drops 6.6%
(6.889 to 6.435 ms, 98.6% of 200 Gb/s line rate). One-shot decode latency
(M=1..24) is unchanged (19.7-66.8 us).

Validation and limitations:
- ARM64 Linux (dgx2): cargo test --locked --release --manifest-path
  helios/Cargo.toml --features roce,runtime-core,server passed
  1,728/1,728 (44 GPU-only ignored), including all 6 execution::roce::tests.
- Paired FlashInfer validator on four GB10 Sparks: pytest
  tests/experimental/b12x/comm/test_roce_proxy.py passed 21/21 (including
  live ConnectX-7 HCA rejection of legacy 1168-byte blobs, mismatched
  ring_window, and mismatched ring_bytes); validate_roce_ring_native.py
  passed across all four ranks in both ring mode (120 iterations,
  --skew-rank 2 --scatter-gather) and chain mode (60 iterations,
  --ring-open --scatter-gather).
- Live four-Spark multi-GPU serving via flare run on existing ABI-14
  Inkling 2 Small NVFP4 core gb10-tp4-202611271425 (without re-export)
  passed short decode (60.3 tok/s), 256-token coding decode (80.6 tok/s),
  and 9,229-token multi-chunk cold prefill + 64-token decode (3.529 s
  wall) with 0/16 ConnectX-7 RDMA port errors and clean Orbit drain.
- Limitations: hardware validation covers a four-node GB10 switchless
  ring and chain only; rings larger than four nodes were not tested on
  hardware, and non-ring transports are unchanged.

Design-Signed-Off-By: Antigravity (Gemini); design-review=2e5b
Signed-off-by: woooflet <ford@fordmorris.com>
fordbmorris pushed a commit to fordbmorris/hyperflare-inference that referenced this pull request Nov 30, 2026
…nd drain relays eagerly

On a four-node switchless 200 Gb/s ConnectX-7 --roce-ring, RING_WINDOW=8
(512 KiB in flight per origin and rail) sat below the two-hop relay
bandwidth-delay product during large prefill collectives, and run_pipe_op
deferred drain_all(c) while actively posting chunks, delaying relay
forwarding on intermediate ranks. Because RING_WINDOW determines remote
mailbox and ACK offsets (ring_slot and ring_ack_offset), mixed-build
ranks with different window sizes would otherwise connect and write to
mismatched remote RDMA addresses, and keeping ROCE_SEND_DEPTH / 6 (or
/ 4 in ring_service_slot) would not leave enough QP send-queue headroom
for 256 unreserved per-origin ACKs at world=16 with RING_WINDOW=16.

Exact changes (in lockstep with local-inference-lab/flashinfer#157, which
must merge before this vendored update):
- helios/native/roce_proxy.c:
  - Raise RING_WINDOW from 8 to 16 (1 MiB in flight per origin and rail;
    2.008 MiB per rank in the group, 8.03 MiB/rank at world=4, 32.13 MiB
    at world=16).
  - Append uint32_t ring_window and uint64_t ring_bytes to roce_blob_t
    (growing sizeof(roce_blob_t) from 1168 to 1176 bytes) while keeping
    ROCE_ABI_VERSION=14 unchanged so previously exported model cores load
    and serve without re-export. Populate both fields in roce_local_blob
    (0 in mesh mode) and validate exact agreement in roce_connect.
  - Tighten reserve() and ring_service_slot() to ROCE_SEND_DEPTH / 8 (64
    signaled ops, at most 192 chained WRs, leaving room for up to 256
    unreserved per-origin ACKs at world=16 plus 64 WRs of provider SQE
    overhead), guarded by a compile-time _Static_assert.
  - Call drain_all(c) inside run_pipe_op when posted is nonzero and
    c->ring is active. Non-ring transports (c->ring == NULL) are
    unaffected.
- helios/src/execution/roce.rs: assert roce_blob_bytes() == 1176 and
  verify peer_blobs rejects legacy 1168-byte peer records alongside
  foreign ABI and truncated records.
- docs/roce-ring.md: update documented ring host-memory sizing (2.008 MiB
  per rank, 8.03 MiB at 4 ranks, 32.13 MiB at 16 ranks) and 16-packet
  in-flight window.

Measured benefit on four DGX Spark GB10 nodes over 200 Gb/s ConnectX-7
(--roce-ring, H=4608 BF16): ReduceScatter drops 7.1% at M=8192 (3.487 to
3.239 ms, 17.48 GB/s bus BW) and 7.4%-9.7% at M=2048..4096; GatherShards
at M=8192 drops 6.2% (3.491 to 3.275 ms); Twoshot at M=8192 drops 6.6%
(6.889 to 6.435 ms, 98.6% of 200 Gb/s line rate). One-shot decode latency
(M=1..24) is unchanged (19.7-66.8 us).

Validation and limitations:
- ARM64 Linux (dgx2): cargo test --locked --release --manifest-path
  helios/Cargo.toml --features roce,runtime-core,server passed
  1,728/1,728 (44 GPU-only ignored), including all 6 execution::roce::tests.
- Paired FlashInfer validator on four GB10 Sparks: pytest
  tests/experimental/b12x/comm/test_roce_proxy.py passed 21/21 (including
  live ConnectX-7 HCA rejection of legacy 1168-byte blobs, mismatched
  ring_window, and mismatched ring_bytes); validate_roce_ring_native.py
  passed across all four ranks in both ring mode (120 iterations,
  --skew-rank 2 --scatter-gather) and chain mode (60 iterations,
  --ring-open --scatter-gather).
- Live four-Spark multi-GPU serving via flare run on existing ABI-14
  Inkling 2 Small NVFP4 core gb10-tp4-202611271425 (without re-export)
  passed short decode (60.3 tok/s), 256-token coding decode (80.6 tok/s),
  and 9,229-token multi-chunk cold prefill + 64-token decode (3.529 s
  wall) with 0/16 ConnectX-7 RDMA port errors and clean Orbit drain.
- Limitations: hardware validation covers a four-node GB10 switchless
  ring and chain only; rings larger than four nodes were not tested on
  hardware, and non-ring transports are unchanged.

Design-Signed-Off-By: Antigravity (Gemini-4-Neon); design-review=2e5b
Signed-off-by: woooflet <ford@fordmorris.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant